import { stringify } from 'qs';
import request from '../utils/request';
import API from './ipConfig'

/**
 *获取充值配置
 *
 */
export async function getRechargeConfig() {
  return request(`${API}/sys/eventManage/getRechargeConfig`, {
    method: 'GET',
  });
}



/**
 * 修改充值配置
 *
 * @export
 * @returns
 */
export async function updateRechargeConfig(params) {
  return request(`${API}/sys/eventManage/updateRechargeConfig`, {
    method: 'POST',
    body: params,

  });
}

/**
 * 获取福利金配置
 */

export async function getWelfareConfig() {
  return request(`${API}/sys/eventManage/getWelfareConfig`, {
    method: 'GET',
  });
}


/***
 * 获取商家列表
 */

export async function getStoreList() {
  return request(`${API}/sys/storeManage/getStoreList`, {
    method: 'GET',
  });
}

/***
 * 获取商家详情
 */

export async function findOne(params) {
  return request(`${API}/sys/storeManage/findOne?storeId=${params.id}`, {
    method: 'GET',
  });
}

/***
 * 删除商家
 */

export async function deleteStore(params) {
  return request(`${API}/sys/storeManage/deleteStore`, {
    method: 'POST',
    body: params,
  });
}

/***
 * 修改商家信息
 */

export async function updateStore(params) {
  return request(`${API}/sys/storeManage/updateStore`, {
    method: 'POST',
    body: params,
  });
}

/***
 * 获取商家列表
 */

export async function SearchStoreName(params) {
  return request(`${API}/sys/storeManage/getStoreList?storeName=${params.storeName}`, {
    method: 'get',
  });
}

/***
 * 获取商家资金明细
 */

export async function getStoreFinancialDetails(params) {
  return request(`${API}/sys/storeManage/getStoreFinancialDetails?storeId=${params.storeId}&size=7`, {
    method: 'get',
  });
}

/***
 * 获取商家资金明细-分页
*/

export async function getStoreFinancialDetailsPage(params) {
  return request(`${API}/sys/storeManage/getStoreFinancialDetails?storeId=${params.storeId}&size=7&index=${params.index}`, {
    method: 'get',
  });
}


/***
 * 获取商家资金明细-根据日期搜索
 */

export async function getStoreFinancialDetailsDate(params) {
  return request(`${API}/sys/storeManage/getStoreFinancialDetails?storeId=${params.storeId}&size=7&index=${params.index}&beginTime=${params.beginTime}&endTime=${params.endTime}`, {
    method: 'get',
  });
}


/***
 * 根据分页获取商家详情
 */

export async function getStoreListPage(params) {
  return request(`${API}/sys/storeManage/getStoreList?index=${params.index}`, {
    method: 'get',
  });
}

/**
 * 置顶商家
 */
export async function stick(params) {
  console.log()
  return request(`${API}/sys/storeManage/stick?id=${params}`, { method: 'post' })
}